package com.selftest.controller;

import com.selftest.bean.User;
import com.selftest.web.annotation.Ignore;
import com.selftest.web.annotation.ResponseJSON;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class TestController {

    @GetMapping("test")
    public String test(String name){
        return "access success";
    }

    @PostMapping("hello")
    public String hello(@RequestBody User user){
        int i = 1 / 0;
        System.out.println(user);
        return "Hello";
    }

    @ResponseJSON(ignore = {
            @Ignore(declaringClass = User.class, propNames = {"age"})
    })
    @GetMapping("users")
    public User getUser(){
        User user = new User();
        user.setId(1);
        user.setName("phen");
        user.setAge(30);
        return user;
    }

}
